<%@page import="java.util.List,com.crm.beans.PurchaseOrderVO"%>
<%
String address=null;
if(request.getAttribute("address")!=null){
	address=request.getAttribute("address").toString();
}
%>
<%
String tandc=(String)request.getAttribute("terms");
	if(request.getAttribute("opportunity")!=null){
		List<PurchaseOrderVO> ls=(List<PurchaseOrderVO>)request.getAttribute("opportunity");	
%>


<table width="100%" border="0" cellpadding="4" cellspacing="1" bgcolor="#C5E4EB">
          <tr>
            <td width="36" align="center" valign="middle" background="<%=application.getContextPath() %>/images/table-box.jpg"  style="background-repeat:repeat-x">S.No </td>
            <td width="138" align="center" valign="middle" background="<%=application.getContextPath() %>/images/table-box.jpg"   style="background-repeat:repeat-xbgcolor="#FFFFFF">Part Number</td>
            <td width="140" align="center" valign="middle" background="<%=application.getContextPath() %>/images/table-box.jpg"   style="background-repeat:repeat-xbgcolor="#FFFFFF"> Qty </td>
            <td width="162" align="center" valign="middle" background="<%=application.getContextPath() %>/images/table-box.jpg"  style="background-repeat:repeat-x bgcolor="#FFFFFF">Source</td>
            <td width="186" align="center" valign="middle" background="<%=application.getContextPath() %>/images/table-box.jpg"   style="background-repeat:repeat-xbgcolor="#FFFFFF">Supplier</td>
            <td width="186" align="center" valign="middle" background="<%=application.getContextPath() %>/images/table-box.jpg"   style="background-repeat:repeat-xbgcolor="#FFFFFF">Unit Price</td>
            <td width="186" align="center" valign="middle" background="<%=application.getContextPath() %>/images/table-box.jpg"   style="background-repeat:repeat-xbgcolor="#FFFFFF">Sum</td>
            <td width="186" align="center" valign="middle" background="<%=application.getContextPath() %>/images/table-box.jpg"   style="background-repeat:repeat-xbgcolor="#FFFFFF">MOQ</td>
          </tr>
          <%for(int i=0;i<ls.size();i++){
        	  %>
          
          <tr>
            <td bgcolor="#FFFFFF"><%=i+1 %></td>
            <input name="partid<%=i+1 %>" type="hidden" size="5" value="<%=ls.get(i).getPartid()%>"/>
            <td align="left" valign="top" bgcolor="#FFFFFF"><input name="partNumber<%=i+1 %>" type="text" size="5" value="<%=ls.get(i).getPartNumber()%>"/></td>
            <td align="left" valign="top" bgcolor="#FFFFFF"><input name="qty<%=i+1 %>" type="text" size="5" value="<%=ls.get(i).getQuantity()%>"/></td>
            <td align="left" valign="top" bgcolor="#FFFFFF"><input name="source<%=i+1 %>" type="text" size="5" value="<%=ls.get(i).getSource()%>"/></td>
            <td align="left" valign="top" bgcolor="#FFFFFF"><input name="supplier<%=i+1 %>" type="text" size="5" value="<%=ls.get(i).getSupplier()%>"/></td>
            <td align="left" valign="top" bgcolor="#FFFFFF"><input name="unitPrice<%=i+1 %>" type="text" size="5" value="<%=ls.get(i).getUnitPrice()%>"/></td>
            <td align="left" valign="top" bgcolor="#FFFFFF"><input name="sum<%=i+1 %>" type="text" size="5" value="<%=ls.get(i).getSum()%>"/></td>
            <td align="left" valign="top" bgcolor="#FFFFFF"><input name="moq<%=i+1 %>" type="text" size="5" value="<%=ls.get(i).getMoq()%>"/></td>
          </tr>
          <%} %>
          <input type="hidden" value="<%=ls.size() %>" name="rowCount"/>
        </table>
        	    <table width="250" border="0" align="right" cellpadding="0" cellspacing="0">
	    <tr><td>&nbsp;</td></tr>
          <tr>
            <td  align="left" valign="middle">Total</td>
            <td  valign="middle"><input name="total" type="text" class="form" id="totalId" value="<%=request.getAttribute("total")%>"/></td>
          </tr>
        </table>
     
     <%}%>
<table width="100%">
<tr><td>&nbsp;</td></tr>
<tr>
<td align="left" valign="top" width="180px">
<table>
<tr><td align="left" valign="top" width="15%">Purchase OrderNo:</td></tr>
<tr><td align="left" valign="top">
<input type="text" name="pono" id="pono" value=""   class="form"></input>
<tr>
<tr><td align="left" valign="top" width="15%">Supplier Reference No. :</td></tr>
<tr><td align="left" valign="top">
<input type="text" name="sorefno"  id="sorefno" value=""   class="form"></input>
<tr>
<td align="left" valign="top">Billing Address:</td></tr>
<tr><td align="left" valign="top">
<textarea name="billto" class="form-textarea"><%=address%></textarea></td></tr>
<tr><td align="left" valign="top">Shipping Address:</td></tr>
<tr><td align="left" valign="top">
<textarea    name="shipto" class="form-textarea"><%=address%></textarea></td></tr>
</table></td>
<td align="right" valign="top">
<table> <tr><td>&nbsp;</td></tr>
<tr><td valign="top" align="center" >Terms And Conditions</td></tr>
      <tr><td valign="middle" align="right">
       <textarea rows="10" cols="70" name="terms"><%=tandc %></textarea>
       </td></tr>
       <tr><td>&nbsp;</td></tr>
       <tr><td valign="top" align="right" >
       <table>
       <tr>
       <td valign="top" align="center" width="50%">
       <input type="submit" class="button" value="Generate P.O" onclick="javascript:return validate();">
       </td>
       <td valign="top" align="center" width="50%">
       <input type="button" class="button" value=" Excess P.O">
       <input type="hidden"  value="0" id="tc">
       </td></tr></table></td>
       </tr></table></td></tr>
       </table>
	    <script type="text/javascript">
	    $(function(){
			 var client="<%=request.getAttribute("clientdet")%>";
			 var cldiv="<%=request.getAttribute("division")%>";
			 var cluser="<%=request.getAttribute("user")%>";
			 $("#enqclient").html("Client Name Is:<span class='cliendet'>"+client +
			"</span>   &nbsp;&nbsp;&nbsp;&nbsp;  Client Division Is:<span class='cliendet'>"+cldiv+
			 "</span>    &nbsp;&nbsp;&nbsp;&nbsp;    Client User Is:<span class='cliendet'>"+cluser+"</span>");
			 $("#enqclient").show();
	    	
			 
			 var refno=$("#reflistid").val();
	    	$("#pono").val(refno);
	    	});
</script>
	  